package com.woniuxy.yoga.admin.web.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.yoga.admin.dao.model.PaymentLog;
import com.woniuxy.yoga.admin.model.form.paymentlog.PaymentLogForm;
import com.woniuxy.yoga.admin.service.PaymentLogService;
import com.woniuxy.yoga.commons.core.model.Result;
import com.woniuxy.yoga.commons.web.log.YogaLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 商家缴费日志表 前端控制器
 * </p>
 *
 * @author 韦用文,刘存益,郎腾霄
 * @since 2023年11月28日
 */
@RestController
@RequestMapping("/paymentLog")
@Api(tags = "商家缴费日志相关接口")
public class PaymentLogController {

    @Autowired
    private PaymentLogService paymentLogService;

    /**
     * 新增商家缴费日志
     * @param form
     * @return
     */
    @PostMapping("/addPaymentLog")
    @ApiOperation("新增商家缴费日志")
    @YogaLog("新增商家缴纳入驻费日志")
    public Result<Boolean> addPaymentLog(@RequestBody PaymentLogForm form){
        Boolean bool = paymentLogService.save(BeanUtil.toBean(form, PaymentLog.class));
        return Result.getResult(Boolean.class).setMessage("生成缴费日志成功").setData(bool);
    }


}

